{template 'common/header'}
{template 'nav'}
{if $op == 'list'}
<div class="panel panel-default">
	<div class="panel-heading">筛选</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="a" value="entry" />
			<input type="hidden" name="m" value="meepo_xianchang" />
			<input type="hidden" name="do" value="user_manage" />
            
            <input type="hidden" name="id" value="{$id}" />
           
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">用户名称</label>
				<div class="col-xs-12 col-sm-8 col-lg-8">
					<input class="form-control" name="nickname" id="" type="text" value="{$_GPC['nickname']}" placeholder="请输入粉丝昵称">
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
				<div class="col-sm-8 col-lg-9 col-xs-12">
					<input class="btn btn-primary" id="" type="submit" value="搜索">
				</div>
			</div>
		</form>
	</div>
</div>
<form action="" method="post" class="form-horizontal" role="form" ng-controller="formCtrl" id="form2">
	<div class="panel panel-default">
		<div class="panel-heading">
			用户列表
		</div>
		<div class="panel-body table-responsive">
			<table class="table table-hover" style="display:auto;">
				<thead class="navbar-inner">
					<tr >
					   <th style="width:5em;text-align:center" >选？</th>
					   <th style="width:10em;text-align:center">签到用户</th>
					   <th style="width:10em;text-align:center">手机号码</th>
					   <th style="width:5em;text-align:center">状态</th>
					   <th style="width:12em;text-align:center">加入时间</th>
                       <th style="width:35em;text-align:center">操作</th>
					</tr>
				</thead>
				<tbody>
					{loop $users $key $item}
					<tr>
						<td><input type="checkbox" name="select[]" value="{php echo $item['id']}"></td>
						
					  	<td class="row-hover" style="text-align:center">
								<img width="50" src="{$item['avatar']}" class="avatar" />
								<div class="mainContent">
									<div class="nickname" style="text-align:center">{$item['nick_name']}</div>
								</div>
					    </td>
						<td class="row-hover" style="text-align:center">
							{if !empty($item['mobile'])}{$item['mobile']}{else}未录入{/if}
					    </td>
						<td class="row-hover" style="text-align:center">
							{if $item['status']==1}通过{else}未通过{/if}
					    </td>
					    <!-- 
						<td class="row-hover" style="text-align:center">
								{if $item['nd_id']}{$item['tag_name']}{else}未内定{/if}
					    </td>
					     -->
						<td class="row-hover" style="text-align:center">
								{php echo  date('Y-m-d H:i:s',$item['createtime'])}
					    </td>
						<td style="text-align:center">
							<a class="btn btn-success" href="{php echo $this->createWebUrl('user_manage',array('op'=>'post','id'=>$id,'user_id'=>$item['id']))}"
								ng-mouseenter="tooltip()" data-toggle="tooltip" data-placement="top" title="删除">编辑
								<i class="fa fa-edit"></i>
							</a>
						</td>
					</tr>
					{/loop}
				</tbody>
				<tr>
					<td><input type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});"></td>
                    <td colspan="12">
						<input type="submit" class="btn btn-pramary" name="down" value="导出选定数据" />
                        <input type="submit" class="btn btn-pramary" name="downall" value="导出所有数据" />
						<input type="hidden" name="token" value="{$_W['token']}">
                    </td>
				</tr>
			</table>

		</div>
	</div>
</form>
{$pager}
<script>
	require(['angular', 'jquery', 'util'], function(angular, $, util){

		var app = angular.module('app', []);
		app.controller('formCtrl', function($scope,$http){
			$scope.tooltip = function(){
		      $('[data-toggle="tooltip"]').tooltip();
		    }
		});
		angular.bootstrap(document, ['app']);
	});

</script>
<div class="modal fade" id="manage-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document" style="width:100% !important">
		<div class="modal-content" style="width:100% !important">
			<div class="modal-header">
				
			</div>
			<div class="modal-body">

			</div>
			<div class="modal-footer">
				
				<button type="button" class="btn btn-primary">关闭</button>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
require(['jquery','util'], function($, u){
		     $('.show_bd_data').click(function(){
				var uid = $(this).data('uid');
				$.post("{php echo $this->createWebUrl('user_manage',array('op'=>'show_bd_data','rid'=>$rid))}", {'openid':$(this).attr('data-openid')}, function(d){
					if(d.ret==0) {
						
						$('#manage-modal .modal-body').html(d.data);
						$('#manage-modal').modal('show');

						$('#manage-modal .btn-primary').unbind('click');
						$('#manage-modal .btn-primary').click(function(){
							$('#manage-modal').modal('hide');
							return false;
						});
					} else {
						u.message('系统出错', '', 'error');
						return false;
					}
				},"json");
			});
});
</script>
{elseif $op=='post'}
<form action="" method="post" class="form-horizontal" role="form">
<input type="hidden" value="{$user['id']}" class="form-control" name="user_id">
<div class="panel panel-default">
	<div class="panel-heading">{if $user['id']}编辑{else}新增{/if}用户资料</div>	
	<div class="panel-body">
	<div class="tab-content">
	<div class="tab-pane  active" id="tab_basic">
		<div class="panel panel-default">
			<div class="panel-heading"></div>					
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">用户头像</label>
					<div class="col-sm-9">
						{php echo tpl_form_field_image('avatar', $user['avatar']);}
						<span class="help-block">用户头像</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">粉丝昵称</label>
					<div class="col-sm-9">
						<input type="text" value="{$user['nick_name']}" class="form-control" name="nick_name" >
						<span class="help-block">粉丝昵称</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">手机号码</label>
					<div class="col-sm-9">
						<input type="text" value="{$user['mobile']}" class="form-control" name="mobile" >
						<span class="help-block">手机号码</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2  control-label">性别</label>
					<div class="col-sm-9 ">
						<label class="radio-inline">
							<input type="radio" name="sex" value="1" id="isshow_1" {if $user['sex'] == '1'}checked="true"{/if}> 男
						</label>
						<label class="radio-inline">
							<input type="radio" name="sex" value="2" id="isshow_0"  {if $user['sex'] == '2'}checked="true"{/if}>女
						</label>
					</div>
				</div>
				{if empty($user['id'])}
					<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2  control-label">是否已经签到成功</label>
					<div class="col-sm-9 ">
						<label class="radio-inline">
							<input type="radio" name="had_sign" value="1" id="isshow_1" checked> 是
						</label>
						<label class="radio-inline">
							<input type="radio" name="had_sign" value="2" id="isshow_0">否
						</label>
					</div>
				</div>
				{/if}
			</div>
		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>

	</div>
	</div>
	</div>
	</div>
	</form>
{elseif $op=='upload_user'}
	<div class="main">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" id="form1">
		<div class="panel panel-default">
			<div class="panel-heading">
				批量导入用户<br>
				<a href="../addons/meepo_xianchang/user.xls" target="dd"  class="green">下载模板文件user.xls</a></label> (右键另存为)
			</div>
			<div class="panel-body">
				
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">上传文件</label>
					<div class="col-sm-9 col-xs-12">
                            <input name="file" id="file" type="file" />
					</div>
				</div>
				
			</div>
		</div>
		
		<div class="form-group col-sm-12">
			<input type="submit" name="fileupload" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</form>
</div>
{/if}	

{template 'common/footer'}
